import request from '@/utils/request'

export interface CreatePaymentParams {
  orderNo: string
  paymentMethod: string
}

// 创建支付单
export const createPayment = (data: CreatePaymentParams) => {
  return request.post('/api/payments/create', data)
}

// 查询支付状态
export const queryPaymentStatus = (paymentNo: string) => {
  return request.get(`/api/payments/status/${paymentNo}`)
}

// 关闭支付单
export const closePayment = (paymentNo: string) => {
  return request.post(`/api/payments/cancel/${paymentNo}`)
}

// 获取支付二维码
export const getPaymentQrCode = (orderNo: string) => {
  return request.get(`/api/payments/qrcode/${orderNo}`)
}
